package org.example.demo21.config;


import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.annotations.OpenAPI30;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author gc
 */
@Configuration
@OpenAPI30
public class ApiConfig {

    @Bean
    public GroupedOpenApi demoApi() {
        return GroupedOpenApi.builder()
                .group("demo")
                .packagesToScan("org.example.demo21")
                .build();
    }

    @Bean
    public OpenAPI openApi() {
        return new OpenAPI()
                .info(new Info().title("demo API")
                        .description("demo for springboot v3")
                        .version("v3.0.0")
                        .license(new License().name("demo for springboot v3").url("demo application")))
                .externalDocs(new ExternalDocumentation()
                        .description("no wiki !")
                        .url(""));
    }
}
